/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Minh Luc
 */
@Entity
@Table(name = "Feedback", catalog = "P2PDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Feedback.findAll", query = "SELECT f FROM Feedback f ORDER BY f.feedbackDate DESC"),
    @NamedQuery(name = "Feedback.findByFeedbackId", query = "SELECT f FROM Feedback f WHERE f.feedbackId = :feedbackId"),
    @NamedQuery(name = "Feedback.findByFeedBackTitle", query = "SELECT f FROM Feedback f WHERE f.feedBackTitle = :feedBackTitle"),
    @NamedQuery(name = "Feedback.findByFeedBackContent", query = "SELECT f FROM Feedback f WHERE f.feedBackContent = :feedBackContent"),
    @NamedQuery(name = "Feedback.findByReplyContent", query = "SELECT f FROM Feedback f WHERE f.replyContent = :replyContent"),
    @NamedQuery(name = "Feedback.findByFeedbackDate", query = "SELECT f FROM Feedback f WHERE f.feedbackDate = :feedbackDate"),
    @NamedQuery(name = "Feedback.findByFeedStatus", query = "SELECT f FROM Feedback f WHERE f.feedStatus = :feedStatus")})
public class Feedback implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "FeedbackId", nullable = false)
    private Integer feedbackId;
    @Column(name = "FeedBackTitle", length = 255)
    private String feedBackTitle;
    @Column(name = "FeedBackContent", length = 2147483647)
    private String feedBackContent;
    @Column(name = "ReplyContent", length = 2147483647)
    private String replyContent;
    @Column(name = "FeedbackDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date feedbackDate;
    @Column(name = "FeedStatus", length = 20)
    private String feedStatus;
    @JoinColumn(name = "UserIdReply", referencedColumnName = "UserId")
    @ManyToOne
    private Users userReply;
    @JoinColumn(name = "UserIdSend", referencedColumnName = "UserId")
    @ManyToOne
    private Users userSend;

    public Feedback() {
    }

    public Feedback(Integer feedbackId) {
        this.feedbackId = feedbackId;
    }

    public Integer getFeedbackId() {
        return feedbackId;
    }

    public void setFeedbackId(Integer feedbackId) {
        this.feedbackId = feedbackId;
    }

    public String getFeedBackTitle() {
        return feedBackTitle;
    }

    public void setFeedBackTitle(String feedBackTitle) {
        this.feedBackTitle = feedBackTitle;
    }

    public String getFeedBackContent() {
        return feedBackContent;
    }

    public void setFeedBackContent(String feedBackContent) {
        this.feedBackContent = feedBackContent;
    }

    public String getReplyContent() {
        return replyContent;
    }

    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }

    public Date getFeedbackDate() {
        return feedbackDate;
    }

    public void setFeedbackDate(Date feedbackDate) {
        this.feedbackDate = feedbackDate;
    }

    public String getFeedStatus() {
        return feedStatus;
    }

    public void setFeedStatus(String feedStatus) {
        this.feedStatus = feedStatus;
    }

    public Users getUserReply() {
        return userReply;
    }

    public void setUserReply(Users userReply) {
        this.userReply = userReply;
    }

    public Users getUserSend() {
        return userSend;
    }

    public void setUserSend(Users userSend) {
        this.userSend = userSend;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (feedbackId != null ? feedbackId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Feedback)) {
            return false;
        }
        Feedback other = (Feedback) object;
        if ((this.feedbackId == null && other.feedbackId != null) || (this.feedbackId != null && !this.feedbackId.equals(other.feedbackId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Feedback[feedbackId=" + feedbackId + "]";
    }

}
